package cn.springcloud.fix.demo.design.strategy;

public enum ArithmeticEnum implements ArithmeticOperation {

    /**
     * 加
     */
    PLUS {
        @Override
        public int calculate(int a, int b) {
            return a + b;
        }
    },
    /**
     * 减
     */
    MINUS {
        @Override
        public int calculate(int a, int b) {
            return a - b;
        }
    },
    /**
     * 乘
     */
    MULTIPLY {
        @Override
        public int calculate(int a, int b) {
            return a * b;
        }
    },
    /**
     * 除
     */
    DIVIDE {
        @Override
        public int calculate(int a, int b) {
            return a / b;
        }
    };

    public static void main(String[] args) {
        ArithmeticEnum arithmeticEnum = ArithmeticEnum.valueOf("PLUS");
        int r = arithmeticEnum.calculate(1, 2);
        System.out.println(r);
    }
}
